﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Macds.Debug.Test.ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                // Create dynamic proxy class that includes the debug interceptor
                var service = DebugFactory.CreateProxy<ICustomerService>(new CustomerService());

                // Execute the methods of the class
                service.GetEmail(1);
                service.CustomerExists("username");
                service.GetCustomerID("username");
                service.ValidateCustomer("username", "password");

                var customerOut = new Customer();
                service.ValidateCustomerOut("username", "password", out customerOut);

                // The following method receive a class as argument
                var customer = new Customer() { CustomerID = 1, Email = "demo@email.com", Username = "username", Password = "password" };
                
                customer.Addresses = new List<Address>();
                customer.Addresses.Add(new Address() { Country = "USA", City = "Miami", State = "Florida" });
                customer.Addresses.Add(new Address() { Country = "PA", City = "Panama", State = "Panama" });
                var streets = new List<string>();
                streets.Add("#1");
                streets.Add("#2");

                customer.Addresses[1].Streets = streets.ToArray();

                service.UpdateCustomer(customer);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadLine();
        }
    }
}
